package cn.funeralobjects.upms;

import cn.funeralobjects.common.jpa.CommonJpaRepository;
import cn.funeralobjects.common.jpa.support.CommonRepositoryFactoryBean;
import cn.funeralobjects.util.aop.AssertArgAspect;
import com.querydsl.jpa.JPQLQueryFactory;
import com.querydsl.jpa.impl.JPAQueryFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;

import javax.persistence.EntityManager;

/**
 * @author FuneralObjects
 * Create date: 2020/4/27 11:38 AM
 */
@SpringBootApplication
@EnableJpaRepositories(repositoryFactoryBeanClass = CommonRepositoryFactoryBean.class, repositoryBaseClass = CommonJpaRepository.class)
public class UpmsWebTestApplication {


    public static void main(String[] args) {
        SpringApplication.run(UpmsWebTestApplication.class, args);
    }

    @Bean
    public AssertArgAspect assertArgAspect() {
        return new AssertArgAspect();
    }

    @Bean
    public JPQLQueryFactory jpqlQueryFactory(EntityManager entityManager) {
        return new JPAQueryFactory(entityManager);
    }
}
